<?php
class ArticleTable extends Doctrine_Table
{
    
  public static function getInstance()
  {
    return Doctrine_Core::getTable('Article');
  }
  public function getArticleByCategory($category,$max)
  {
	$q = Doctrine_Query::create()
	  ->from('Article k')
	  ->where('k.category_id =?',$category)
	  ->orderBy('id desc')
	  ->limit($max);
	return $q->execute();
  }
  public function getArticleBySpecial($special,$catid,$max)
  {
	$q = Doctrine_Query::create()
	  ->from('Article k')
	  ->addwhere('k.special_id =?',$special)
	  ->addwhere('k.category_id =?',$catid)
	  ->orderBy('id desc')
	  ->limit($max);
	return $q->execute();
  }
}